package com.prb.app.controller;

import com.prb.app.service.UserService;
import com.prb.framework.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@PrbController
@PrbRequestMapping("/user")
public class UserController {


    @PrbAutoWired
    UserService userService;

    @PrbRequestMapping("/get-user")
    @PrbSecurity("zhangSan")
    public String getUserMsg(HttpServletRequest request , HttpServletResponse response , String name){

        System.out.println(name + " can access");
        return userService.getUserMsg(name);
    }

    @PrbRequestMapping("/get-order")
    @PrbSecurity("lisi")
    public String getOrderMsg(HttpServletRequest request , HttpServletResponse response , String name){

        System.out.println(name + " can access");
        return userService.getUserMsg(name);
    }


    @PrbRequestMapping("/anony-access")
    public String anonyAccess(HttpServletRequest request , HttpServletResponse response){

        System.out.println("anony access .........");

        return "anony access";
    }

}
